const mysql = require('mysql');

const client = mysql.createConnection({
    host:'localhost',
    user:'root',
    password:'',
    database:'ego03'
})

function sqlFn(sql,arr,callback){
    // 执行数据库语句
    client.query(sql,arr,(error,result)=>{
        if(error){
            console.log(error);
            return
        }
        callback(result)
    })
}

module.exports = sqlFn